<?php
class Training_Form_Decorator extends Zend_Form{
	
	public function init(){
		$decoratorsForm = array(			
								'FormElements',
								//'HtmlTag',
								//array('HtmlTag', array('tag' => 'table')),
								 array('HtmlTag', array('class'=>'abc',
								 						'tag' => 'table',
								 						'width' => '100%',
								 						'style'=>'border: 1px solid #ccc;')),	
								'Form',															
								);
		
		$this->setMethod('post')
			->setEnctype('multipart/form-data')
			->setAction('')
			->setName('appForm')
			->setDecorators($decoratorsForm);
		
		/*$decorator = array(
							'ViewHelper',
							'Errors',
							'Description',							
							array('HtmlTag',array('tag'=>'div','class'=>'right')),
							array('Label',array('tag'=>'div','class'=>'left')),
		
							);*/
			
		/*$decorator = array(
							'ViewHelper',
							'Errors',
							'Description',		
							array('HtmlTag',array('tag'=>'div','class'=>'row')),
							array('Label',array('tag'=>'div')),
							);*/
		
		$decorator = array(
						    'ViewHelper',
						    'Errors',
							array('Description',array('tag'=>'span')),
						    array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'rowRight')),
						   /* array('Label', array('tag' => 'td',
						    					'style'=>'display: block;',
						    					'width'=>'250px',
						    					
						    					)),*/
						    'Label',
						    array(array('row2' => 'HtmlTag'), array('tag' => 'td','class'=>'rowLeft')),
						    array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
						);

		//=================Zend_Form_Element_Text================
		$textbox = new Zend_Form_Element_Text('textbox'); //$name
		$textbox->setLabel('Text box:')
				->setDescription('Hien thi o textbox bang Zend Form')
				->setDecorators($decorator)
				->setRequired();
				
		$sumbit = new Zend_Form_Element_Submit('submit');
		$sumbit->setValue('Save now')
			 ->setAttrib('class','input');
			 
		$this->addElements(array($textbox));
		
	}
}